import React, { Component } from 'react';
import { glabalContext } from './common/js/globalData'
class TransferToChild3 extends Component {
    state = {
      a: 20,
      b: 12
    } 
    render() { 
      //  console.log('this', this)
        return (<div>
          子组件child3,使用contextType简化Consumer<br/>
          
          {/*  使用contextType读取全局共享数据 */}
         role:   { this.context.role}<br/>
         amdin: { this.context.email}
         <button onClick={() => this.context.updateRole('张')}>context-updateRole-修改role</button>
        </div>);
    }
}

TransferToChild3.contextType = glabalContext
export default TransferToChild3;